/*
 * Copyright (C) 2024-2025 Deepin Technology Co., Ltd.
 *
 * Author:     zhangbingyi <zhangbingyi@uniontech.com>
 *
 * Maintainer: zhangbingyi <zhangbingyi@uniontech.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#pragma once

#include "loginsafetymodel.h"
#include "common.h"
#include "compixmap.h"


#include <QFrame>
#include <QWidget>

namespace def {
namespace widgets {
class TitleButtonItem;
class TitledSliderItem;
class DCCSlider;
} // namespace widgets
} // namespace def


class PwdLimitLevelItem;
class PwdLevelChangedDlg;


class QVBoxLayout;

using namespace def::widgets;
class LoginSafetyWidget : public QFrame
{
    Q_OBJECT
public:
    explicit LoginSafetyWidget(LoginSafetyModel *model, QWidget *parent = nullptr);
    ~LoginSafetyWidget();
    void initUI();

Q_SIGNALS:
    void requestSyncSystemSecurityLevel();

private:
    // 密码限制等级设置（显示）
    void setPwdLimitLevelDisplay(PwdLimitLevel level);

public slots:
    void setPwdLimitLevelLow();
    void setPwdLimitLevelMedium();
    void setPwdLimitLevelHigh();
    void setPwdLimitedLevelFinished(int level);
    void systemSecurityLevelChanged(int level);
private:
    LoginSafetyModel *m_model; // 登陆安全数据对象
    QVBoxLayout *m_layout; // 主布局器
    PwdLimitLevelItem *m_highLevelItem; // 高密码安全等级项
    PwdLimitLevelItem *m_mediumLevelItem; // 中密码安全等级项
    PwdLimitLevelItem *m_lowLevelItem; // 低密码安全等级项
    PwdLimitLevel m_lastPwdLimitLevel; // 上次设置的密码安全等级
    TitleButtonItem *m_goToSettingsItem; // 跳转到设置界面按钮项
    TitledSliderItem *m_pwdChangeDeadlineItem; // 密码修改到期提醒设置条
};
